package sajat.onlab;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;

public class MapDataOverlay extends Overlay {
	
	private GeoPoint point;
	
	public MapDataOverlay() {

	}
			
	@Override 
	public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) { 
		super.draw(canvas, mapView, shadow);
		
		Point screenPts = new Point();
		
		if (point != null) mapView.getProjection().toPixels(point, screenPts); 
		
		Paint textPaint = new Paint();
		
		if (point!=null) {
		textPaint.setColor(Color.RED);
		textPaint.setStrokeWidth(6f);
		textPaint.setAntiAlias(true);
		canvas.drawCircle(screenPts.x, screenPts.y, 8, textPaint);
		}
		
		return true;
	}
	
	public void setPoint(GeoPoint point) {
		this.point = point;
	}

}